package com.yitao.client.constant;

import com.skipper.base.bean.DataOutput;
import com.yitao.client.dto.enums.BooleanEnumDto;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ShopEnums {

    /**
     * 未发布 0 已经发布 1 已经结束 2
     */
    public enum ShopType {
        /**
         * 跨境店铺  国内店铺
         */
        TRANSBOUNDARY_SHOP(1, "跨境店铺"),
        DOMESTIC_SHOP(2, "国内店铺");

        private static final Map<Integer, ShopEnums.ShopType> map = new HashMap<>();

        static {
            ShopEnums.ShopType[] values = ShopEnums.ShopType.values();
            for (ShopEnums.ShopType item : values) {
                map.put(item.code, item);
            }
        }

        private final Integer code;
        private final String name;

        private ShopType(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        public static ShopEnums.ShopType getEnum(Integer code) {
            return map.get(code);
        }

        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 地址类型 false或者null都为国内
     */
    public enum OverseasUserEnum {

        INLAND(false, "国内地址"),
        FOREIGN(true, "国外地址");
        private final Boolean code;
        private final String desc;

        private OverseasUserEnum(Boolean code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public Boolean getCode() {
            return this.code;
        }

        public String getDesc() {
            return this.desc;
        }

        public static String getDescByCode(Integer code) {
            ShopEnums.OverseasUserEnum[] var1 = values();
            int var2 = var1.length;

            for(int var3 = 0; var3 < var2; ++var3) {
                ShopEnums.OverseasUserEnum e = var1[var3];
                if (e.getCode().equals(code)) {
                    return e.getDesc();
                }
            }

            return null;
        }

        public static DataOutput<BooleanEnumDto> getOverseasUserEnum() {
            List<BooleanEnumDto> list = new ArrayList();
            ShopEnums.OverseasUserEnum[] var1 = values();
            int var2 = var1.length;

            for(int var3 = 0; var3 < var2; ++var3) {
                ShopEnums.OverseasUserEnum e = var1[var3];
                BooleanEnumDto enumDto = new BooleanEnumDto();
                enumDto.setCode(e.code);
                enumDto.setDesc(e.desc);
                list.add(enumDto);
            }

            return new DataOutput(list);
        }
    }

    /**
     * 店铺支付方式
     */
    public enum SHOP_PAYMENT_METHOD{
        WE_CHAT(1, "微信支付"),
        BANK_CARD(2, "银行卡支付"),
        OFFLINE_PAYMENT(3, "线下支付");

        private  Integer code;
        private  String name;
        private static Map<Integer, String> map = new HashMap<>();

        SHOP_PAYMENT_METHOD(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        static {
            for(SHOP_PAYMENT_METHOD shop_payment_method: SHOP_PAYMENT_METHOD.values()){
                map.put(shop_payment_method.getCode(), shop_payment_method.getName());
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public static String getNameByCode(Integer code){
            return map.get(code);
        }

    }

}
